package com.guoju.tyframework.mvc.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.ServletContext;

import com.guoju.tyframework.mvc.ServletConstants;

public class CommonUtils {
	public static final String DATE_PARSE_PATTERN="yyyy-MM-dd";
	public static String toUpperCaseFirstOne(String string){
		if(Character.isUpperCase(string.charAt(0))){
			 return string;
		}else{
			return (new StringBuilder()).append(Character.toUpperCase(string.charAt(0))).append(string.substring(1)).toString();
		}
	}

	public static boolean isEmpty(String str){

		return (null==str||str.equals(""));
	}
	
	public static boolean isNotEmpty(String str){

		return (null!=str&&!str.equals(""));
	}
	
	public static Date parseStrByPattern(String str,String pattern) throws ParseException{
		if(isEmpty(pattern)){
			pattern=DATE_PARSE_PATTERN;
		}
		SimpleDateFormat adf=new SimpleDateFormat(pattern);
		return adf.parse(str);
	}
	
	
	public static Object getMetaTypeValue(String value,String type){
		Object o=null;
		
		return o;
	}
	
	
}
